<?php
include_once("../../../common/module/checkA.php");
include_once("../../../../config.php");
include_once("../../finance/controller/model/setting.php");
$plate=select_one_line_all_items($table_Prefix."plate","mid = 'finance'");
?>


<?
//用来判断当前系统属于什么板块
$system_part = $plate['mid'];
?>






<?php
//接收需要修改的数据的id
$new_detail_nid = addslashes($_REQUEST['nid']);

//获取旧数据信息
$old_detail=select_one_line_all_items($table_Prefix."finance","nid = ".$_REQUEST['nid']);



//传递过来的页面信息。返回的时候，会根据这些信息返回原来的页面
$nowpageid      = addslashes($_REQUEST['nowpageid']);
$sortby         = addslashes($_REQUEST['sortby']);
$term_nid       = addslashes($_REQUEST['term_nid']);
?>


<?
$_REQUEST['ai_ip']          =  addslashes($_SERVER['REMOTE_ADDR']);
$_REQUEST['ai_authur']      = $_SESSION['username'];




//这里是涉及上传文件的部分：包含图片和附件。视频也应该用这种形式上传
//20220315同时把旧的文件，移动到delete中。
//统一设置一下保存图片的路径
$_uf['path']        = ROOT_PATH_ . "/uploadfiles/";

//创建删除文件存放文件夹
if(!file_exists($_uf['path'] ."/delete/")){
    mkdir($_uf['path'] ."/delete/",0777,true);
    chmod($_uf['path'] ."/delete/",0777);
}


//certificate
if (is_uploaded_file($_FILES['certificate']['tmp_name']))
{
    $_uf['upfile']       = $_FILES['certificate'];
    $_info               = upload_file($_uf);
    $_REQUEST['ai_certificate'] = $_info['name'];
    if(($_REQUEST['ai_certificate'])&&($old_detail['certificate']!="alpha.gif"))
    {
        rename($_uf['path'].$old_detail['certificate'], $_uf['path'] ."delete/".$old_detail['certificate']);
    }
}




//设置需要搜索的表格的前缀后缀
$table_Suffix = "finance";
$table        = $table_Prefix . $table_Suffix;

$sql=update_date($table,$_REQUEST,"nid",$new_detail_nid);
$query = mysql_query($sql) or die ("error:".mysql_error());



?>





<?

$nowpageid = $_GET["nowpageid"];
if($nowpageid==1){
    $url = "detail-list.php?nav-itemed=finance";
}
else{
    $url = "detail-list.php?nowpageid=".$nowpageid."&sortby=nid&nid=&sys_part=finance&nav-itemed=finance";
}
?>



<script type="text/javascript">
    window.parent.location.reload();//刷新父页面

</script>

